<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button>发送请求</button>

  <script src="./Promise封装.js"></script>
  <script>
    const btn = document.querySelector('button')
    btn.addEventListener('click', function () {
      Promise.all([
        harryAjax({ method: 'GET', url: 'http://ajax-base-api-t.itheima.net/api/getbooks' }),
        harryAjax({ method: 'GET', url: 'http://ajax-base-api-t.itheima.net/api/getbooks' }),
        harryAjax({ method: 'GET', url: 'http://ajax-base-api-t.itheima.net/api/getbooks' }),
      ])
      .then(res => {
        console.log(res)
        document.write('我是主页')
      })
      .catch(err => {
        console.log(err)
        document.write('404')
      })
    })
  </script>
</body>
</html>